package com.taobao.txc.common.util.c;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.lang.reflect.Method;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class g
{
  public static int a = 150;
  public static int b = 50;
  private static ConcurrentHashMap<String, List<Pattern>> c = new ConcurrentHashMap();
  
  public static String a(String paramString1, String paramString2, String paramString3)
  {
    if (paramString1 == null) {
      return null;
    }
    int i = paramString1.indexOf(paramString2);
    if (i == -1) {
      return paramString1;
    }
    int j = paramString1.indexOf(paramString3, i);
    if (j == -1) {
      return paramString1;
    }
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append(paramString1.substring(0, i));
    localStringBuilder.append(" ");
    localStringBuilder.append(paramString1.substring(j + paramString3.length()));
    return localStringBuilder.toString();
  }
  
  public static String b(String paramString1, String paramString2, String paramString3)
  {
    if (paramString1 == null) {
      return null;
    }
    int i = paramString1.indexOf(paramString2);
    if (i == -1) {
      return null;
    }
    int j = paramString1.indexOf(paramString3, i);
    if (j == -1) {
      return null;
    }
    return paramString1.substring(i + paramString2.length(), j).trim();
  }
  
  public static List<String> a(String paramString)
  {
    if (paramString == null) {
      return null;
    }
    try
    {
      LinkedList localLinkedList = new LinkedList();
      BufferedReader localBufferedReader = new BufferedReader(new StringReader(paramString));
      String str;
      while ((str = localBufferedReader.readLine()) != null) {
        localLinkedList.add(str);
      }
      return localLinkedList;
    }
    catch (IOException localIOException) {}
    return null;
  }
  
  public static String b(String paramString)
  {
    int i = paramString.indexOf(":");
    if (i == -1) {
      return null;
    }
    String str1 = paramString.substring(0, i);
    String str2 = paramString.substring(i + 1);
    return String.format("%s.%s.%s", new Object[] { "com.taobao.txc.vip", str1, str2 });
  }
  
  public static String a(Set<String> paramSet)
  {
    if (paramSet == null) {
      return null;
    }
    StringBuilder localStringBuilder = new StringBuilder();
    int i = 0;
    Iterator localIterator = paramSet.iterator();
    while (localIterator.hasNext())
    {
      String str = (String)localIterator.next();
      if (i == 0)
      {
        i++;
        localStringBuilder.append(str);
      }
      else
      {
        localStringBuilder.append(',');
        localStringBuilder.append(str);
      }
    }
    return localStringBuilder.toString();
  }
  
  public static String a(Method paramMethod)
  {
    return a(paramMethod.getDeclaringClass().getName(), paramMethod.getName());
  }
  
  public static String c(String paramString)
  {
    if ((paramString != null) && (paramString.length() > b)) {
      paramString = String.format("...%s", new Object[] { paramString.substring(paramString.length() - b) });
    }
    return paramString;
  }
  
  public static String a(String paramString1, String paramString2)
  {
    String str = String.format("%s.%s", new Object[] { paramString1, paramString2 });
    if (str.length() > a) {
      str = String.format("...%s", new Object[] { str.substring(str.length() - a) });
    }
    return str;
  }
  
  public static String b(String paramString1, String paramString2)
  {
    return String.format("[%s]:[%s]", new Object[] { paramString1, paramString2 });
  }
  
  private static InputStream e(String paramString)
  {
    return a(paramString, Charset.defaultCharset());
  }
  
  private static InputStream a(String paramString, Charset paramCharset)
  {
    return new ByteArrayInputStream(paramString.getBytes(paramCharset));
  }
  
  public static boolean c(String paramString1, String paramString2)
  {
    try
    {
      if (paramString1.charAt(0) == '`') {
        paramString1 = paramString1.substring(1, paramString1.length() - 1);
      }
      Object localObject1 = (List)c.get(paramString2);
      Object localObject3;
      if (localObject1 == null)
      {
        localObject1 = new ArrayList();
        localObject2 = new DataInputStream(e(paramString2));
        while ((null != (localObject3 = ((DataInputStream)localObject2).readLine())) && (((String)localObject3).length() > 0)) {
          ((List)localObject1).add(Pattern.compile((String)localObject3));
        }
        c.putIfAbsent(paramString2, localObject1);
      }
      Object localObject2 = ((List)localObject1).iterator();
      while (((Iterator)localObject2).hasNext())
      {
        localObject3 = (Pattern)((Iterator)localObject2).next();
        if (((Pattern)localObject3).matcher(paramString1).matches()) {
          return true;
        }
      }
    }
    catch (Exception localException) {}
    return false;
  }
  
  public static String a(byte[] paramArrayOfByte)
  {
    StringBuilder localStringBuilder = new StringBuilder();
    int i = 1;
    localStringBuilder.append("(");
    for (int m : paramArrayOfByte)
    {
      if (i != 0) {
        i = 0;
      } else {
        localStringBuilder.append(",");
      }
      localStringBuilder.append("0x").append(Integer.toHexString(m & 0xFF));
    }
    localStringBuilder.append(")");
    return localStringBuilder.toString();
  }
  
  public static String a(int paramInt)
  {
    Calendar localCalendar = Calendar.getInstance();
    localCalendar.add(6, -paramInt);
    SimpleDateFormat localSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
    return localSimpleDateFormat.format(localCalendar.getTime());
  }
  
  public static Map<String, String> d(String paramString)
  {
    StringTokenizer localStringTokenizer = new StringTokenizer(paramString, "-D");
    HashMap localHashMap = new HashMap();
    while (localStringTokenizer.hasMoreTokens())
    {
      String str1 = localStringTokenizer.nextToken();
      int i = str1.indexOf('=');
      if (i == -1)
      {
        localHashMap.put(str1.trim(), "");
      }
      else
      {
        String str2 = str1.substring(0, i).trim();
        String str3 = str1.substring(i + 1).trim();
        localHashMap.put(str2, str3);
      }
    }
    return localHashMap;
  }
}


/* Location:           C:\Users\ibm\Downloads\txc-yun-sample (1)\txc-yun-sample\lib\txc-client-2.0.72.jar
 * Qualified Name:     com.taobao.txc.common.util.c.g
 * JD-Core Version:    0.7.0.1
 */